home *** CD-ROM | disk | FTP | other *** search
/ Archive Magazine CD 1995 / Archive Magazine CD 1995.iso / discs / prog_disc / volume_8 / issue_07 / risc_pc / CD_INFO
Encoding:
Text File  |  1992-10-19  |  19.3 KB  |  426 lines

  1.                      Common Questions and Answers
  2.  
  3. MSCDEX
  4.  
  5. MSCDEX (or the Microsoft compact disc extension) software standardizes
  6. the way  in which  all CD-ROM  drives are  accessed by  a PC.   On its
  7. release it  could not  fail to  succeed as it was the only independent
  8. software which  allowed the  CD-ROM disc  to appear  as one big floppy
  9. disc to  the end  user.   The following  versions are  likely to be in
  10. existence, still.   If  you are not up to date then contact your drive
  11. supplier to receive a new copy.
  12.  
  13. Version 1.1:   Supported reading high sierra group files.
  14. Version 2.0:   Supported  reading   high  sierra   and  ISO  9660  and
  15.                supported standard audio functions
  16. Version 2.1:   Support for  interleaved Audio in CD-ROM XA, compatible
  17.                with MS-DOS 4.0 and MS-NET compatible.
  18. Version 2.2:   Supports MS-DOS version 5.0.
  19.  
  20. High Sierra (HSG) and ISO 9660 formats
  21.  
  22. The High Sierra Group (HSG) standard was the first attempt to lay down
  23. a formatting  structure for  a CD-ROM  (much  like  the  1.4  Megabyte
  24. formatting standard  for  PC  floppy  disks).    Its  release  allowed
  25. different developers  of CD products to ensure that a wide as possible
  26. range of computer users could read their CDs.
  27.  
  28. Later, a  few small  changes were  made for the sake of efficiency and
  29. computer compatibility and the ISO 9660 standard was born.
  30.  
  31. ISO 9660  access software (or drivers as they are known) are available
  32. for practically  every computer  platform -  making  CD-ROM  the  most
  33. platform-independent medium ever to exist.
  34.  
  35. An ISO  9660 formatted  disc can  be put  into a  PC machine and a DIR
  36. command performed.   In an Apple machine a desktop can be opened, on a
  37. Sun UNIX system a file list operation can be performed.
  38.  
  39. Most PC-orientated CD-ROM discs are ISO 9660 these days.
  40.  
  41.  
  42.  
  43. HFS and other proprietary formats
  44.  
  45. A few  inadequacies in  the ISO  9660 format do exist.  File names can
  46. only consist of characters A to Z and underscore.  A dot is allowed as
  47. a  name/extension   separator.     No  allowance  is  made  for  other
  48. characters, including spaces, lower case letters or names greater than
  49. eight  characters.     Even   worse,  the  standard  does  not  easily
  50. accommodate file  resources.  This of course does not go down too well
  51. in the Apple world - for one thing you loose the pretty icons with ISO
  52. 9660 format.
  53.  
  54. As  an   alternative  the   Apple  systems   can  cope  with  the  HFS
  55. (hierarchical file  system) format.   This  is,  basically,  a  direct
  56. sector for  sector copy  of an  Apple system hard disk and is the most
  57. common format used in the Apple world.  More recently a similar system
  58. has been  used in  the Sun/Unix  world.   VAX VMS  systems also  use a
  59. device format system.
  60.  
  61. Nimbus Information  Systems can manufacture CD-ROM discs with both ISO
  62. 9660 and Apple HFS images on the same disc, keeping both camps happy.
  63.  
  64. Rock-Ridge
  65.  
  66. To get around this problem of multiple standards the Rock-Ridge format
  67. is a  form of ISO+.  Whilst being very similar it allows extended name
  68. characters (much  like the  Commodore/CDTV version  of ISO)  and  file
  69. resources.   It also  copes with  mixed mode and form disc formats for
  70. the XA, CD-I and Bridge standards.
  71.  
  72. How Big is a CD-ROM?
  73.  
  74. New people  to the  world of CD are often confused by the numerous and
  75. varying quotations  for the  capacity of a CD-ROM.  This is mostly due
  76. to the  fact that  CD is a time domain medium, size relates to length.
  77. Nimbus has the world's most accurate mastering lathe and can cut discs
  78. up to  79 minutes  35  seconds  long.    Allowing  some  overhead  for
  79. directory structures,  path tables,  system areas  and a  little  more
  80. besides, let's work on 79 minutes.  The CD-ROM capacity is therefore:
  81.  
  82.  
  83.            79 minutes x 60 seconds x 75 blocks x 2,048 bytes
  84.  
  85. or                  728,064,000 bytes
  86.                  =      711,000 kilobytes
  87.                  =          694 megabytes
  88.  
  89. Let that be it once and for all!
  90.  
  91.  
  92. Blocking factors and efficiency
  93.  
  94. Having said  that the  capacity of a CD-ROM is 694 megabytes it may be
  95. less.   This is due to the blocking structure of the disc.  As on your
  96. hard disk,  the smallest  part of  the disk  that can be accessed is a
  97. sector.   A one  byte file on your hard disk will take up 512 bytes of
  98. storage.   A one  byte file  on a CD-ROM will consume 2,048 bytes (the
  99. sector size  or block).  Thus if you have 1,000,000 one byte files you
  100. will not  get them onto a CD-ROM even though they only total less than
  101. one megabyte!   For this reason, efficient CD-ROMs have a small number
  102. of very large files instead of a large number of very small files.
  103.  
  104. Audio digitization levels
  105.  
  106. The main  levels of  audio digitization  than can  be used on a CD-ROM
  107. (other than proprietary file formats and MPC standards) are CD-Digital
  108. Audio (PCM,  pulse code modulation) and the CD-I ADPCM (adaptive delta
  109. pulse code  modulation).   These standards  allow the  following audio
  110. capacities on a CD-ROM:
  111.  
  112.    
  113.              fs       res      BW         hours s/m      Equiv 
  114.    
  115.    CD-DA   44.1Khz   16 bit   20KHz      1 hr S           DA   
  116.    Lev A   37.8Khz    8 bit   17Khz      2 hr S/4 hr M    LP   
  117.    Lev B   37.8Khz    4 bit   17Khz      4 hr S/8 hr M    FM   
  118.    Lev C   18.9Khz    4 bit   8.5Khz     8 hr S/16 hr M   AM   
  119.    
  120. All about CD-audio
  121.  
  122. CD-Audio, can  play on  the vast  majority of  installed players (only
  123. some of  the older models didn't have the audio circuits included) and
  124. is easily  controlled by  simple software.   Users  must be installing
  125. their CD-ROM  drive with an MSCDEX version 2.0 or greater (see section
  126. on MSCDEX).   The  two main  problems with  using this format to store
  127. audio information are that you can only play audio OR load data at any
  128. one time and you are limited to a maximum of one hour of stereo or two
  129. hours of  mono sound.  Playing audio whilst displaying images can only
  130. be done by:
  131.  
  132.      a)   buffering images in memory before playing an audio sequence,
  133.  
  134.      b)   pre installing images  onto the  users hard disk so recovering
  135.           information from two media at once,
  136.  
  137.      c)   head-whizzing -  load an  image, play  audio, load an image,
  138.           play audio etc...
  139.  
  140. CD-Audio can be accessed in two ways through any standard CD-ROM drive
  141. with audio capabilities:
  142.  
  143.      a)   by track.  Note that  the CD-ROM  track must  be track  one,
  144.           audio tracks will then be available as track 2 to 99.
  145.  
  146.      b)   by time  code. Note  that a  maximum resolution of 75 frames
  147.           per second  is accessible.  In our experience you should aim
  148.           for an  accuracy between  players of the same model of +/- 2
  149.           frames and  between players of different manufacturers +/- 4
  150.           frames.
  151.  
  152. In both  cases you  can choose  to play left, right channels or stereo
  153. (or even mute which you can use for synchronisation).
  154.  
  155. Level A, B and C ADPCM
  156.  
  157. Level A  ADPCM is  no longer  recognized as  a usable  standard and is
  158. unlikely to  be supported  in the future machines.  Whilst the quality
  159. is quite  high (roughly equivalent to that of LP disks)  the potential
  160. gains in additional audio time was thought not to be worth pursuing.
  161.  
  162. Level B  ADPCM is  commonly used  in CD-I  and CD-ROM XA material as a
  163. reasonable quality  compression standard for music, roughly equivalent
  164. to the  sound you  would obtain  of an  FM radio  station (but with no
  165. horrible DJs!).
  166.  
  167. Level C  ADPCM gives  you  a  great  quantity  of  audio  but  with  a
  168. substantial reduction  in quality  and is  usually only considered for
  169. speech - where a high bandwidth is not required.
  170.  
  171. Level B  and C  decoding are  supported by  the  CD-I  and  CD-ROM  XA
  172. machines which  have yet  to penetrate  the market  to a large degree.
  173. Both levels of audio require that the disc be mastered in Mode 2, form
  174. 2 (see discussion of standards and modes) so the mastering house needs
  175. to know.
  176.  
  177. The big  advantage that  ADPCM audio  has over CD-DA is that the sound
  178. can be  interleaved with  data.   Thus enabling  your software to load
  179. images and  text simultaneously  whilst playing  audio sections.  This
  180. interleaving  can  also  be  performed  between  'channels'  of  audio
  181. allowing  the  software  to  switch  between  multilingual  tracks  or
  182. different backing tracks 'on the fly'.  Most players will also play up
  183. to four  channels simultaneously  allow great flexibility in the sound
  184. presented to the end user.
  185.  
  186. Interleaving, how it works and what you loose
  187.  
  188. Interleaving is  at the  expense of  audio capacity  and is  sometimes
  189. quite tricky to work out.  It is best considered by using an example:
  190.  
  191.      A sequence  requires two  different channels  of audio in level B
  192.      mono, one a music background track, one a descriptive voice over.
  193.      What is the data rate available for simultaneous images?
  194.  
  195.      Level B mono audio will consume one eighth of an available second
  196.      per second  of CD  playing time.  Thus, two simultaneous channels
  197.      will consume  one quarter  of a  second per  second playing time.
  198.      Three quarters  of a  second per  second is  available for  other
  199.      data.   Each second  of the  CD in Mode 2, Form 2 has 2,336 bytes
  200.      times 75  blocks.  So three quarters of 2,336 times 75 is 131,400
  201.      bytes per  second.  If your average SVGA image takes up 100K that
  202.      means  you   can  pipe   off  1.3   images  per   second   whilst
  203.      simultaneously playing one or both of the audio tracks.
  204.  
  205.                        Making Efficient CD-ROMs
  206.  
  207. System Elements
  208.  
  209. In order that a developer can optimise a CD-ROM product it is not
  210. just a  simple case  of analysing  the CD-ROM  architecture.  The
  211. performance of  a CD-ROM  is  governed  as  much  by  the  system
  212. elements of  the target  as  by  the  medium.  A  developer  must
  213. understand  each   element  of   such  a   system  and   optimise
  214. accordingly. We will address all of these elements below, ranging
  215. from the  operation  of  the  computer's  operating  system,  the
  216. operating system  extension, the  device driver, the CD-ROM drive
  217. hardware and, of course the CD-ROM itself.
  218.  
  219. We will  approach this  by analysing first the structure of a CD-
  220. ROM and its effect on performance with regard to the system.
  221.  
  222. Directory Structures
  223.  
  224. The logical  sequence of  events when  your programme  requests a
  225. file access  has to  be well  understood before  optimisation can
  226. occur. When a request is sent to open a file the operating system
  227. will first load the path table on the CD-ROM to find the location
  228. of the directory record. Next the directory record will be loaded
  229. to find  the file location, then the byte offset is calculated to
  230. allow the  operating system to finally read  the relevant section
  231. of the  datafile. It can be seen then that this can involve three
  232. disc accesses in order to read a file.
  233.  
  234. All directory  records and  path tables  are stored in 2K logical
  235. blocks. The optimum  directory size, therefore is related to this
  236. block size   such  that   a list  of 40  files (this  is  roughly
  237. dependant on the length of the filenames ) will fill one block. A
  238. list of  42 files  will cover  two blocks  rather  inefficiently.
  239. Loading a  list of  80 files  will  take  as  long  (2/75  second
  240. minimum) as  a list  of 42  files and requires the same amount of
  241. sector cache  ( 4K  ) .  Within a path table you can pack between
  242. 100 and  200  (  again  depending  on  name  length  )  directory
  243. references.
  244.  
  245. All is  not lost  however, both  the path table and the directory
  246. records can  be  buffered  in    'sector  cache  memory'  in  one
  247. operation,  allowing   subsequent  operations   to  request  this
  248. information rather than disc, that is, if you have defined enough
  249. memory. Allowing  enough sector  cache to  cope with  loading the
  250. path table  is very  efficient. All future requests for directory
  251. locations will then be handled within sector cache.
  252.  
  253. Improvements in  access time  can be  made by grouping files in a
  254. single directory  that are  opened together  (or sequentially  ).
  255. Your operating  system will  then reference  the disc  cache when
  256. opening a  file rather  than  accessing  the  disc.  It  is  also
  257. possible to  perform  a  'dummy  access'  to  a  file  when  your
  258. programme is  sitting idle  so  that  the  next  file  access  is
  259. prepared by already loading in the relevant information.
  260.  
  261. Buffering and MSCDEX
  262.  
  263. Using MSCDEX  you can define the disc cache memory using the '/M'
  264. option. If your directory covers 10 sectors and you only define 5
  265. sector cache  blocks then you will end up reloading the directory
  266. every time  you want  to open a file which can cause vast amounts
  267. of time  to be  expended hacking  the CD-ROM  disc.  Define  your
  268. sector caching  to be  the same  as the  largest directory record
  269. plus two  sectors (  the last  two are used by MSCDEX for its own
  270. purposes). A  simple calculation is shown here that allows you to
  271. make a recommendation to your CD-ROM users.
  272.  
  273.      /M :  (largest number of files in a directory / 40 )   +
  274.            (number of directory files / 100 ) + 4
  275.  
  276. As a  general   rule then,  it is  better to  keep your directory
  277. sizes small  and a  multiple of  40 files  and  allow  sufficient
  278. buffering to keep down the number of disc accesses .
  279.  
  280. The last  hint is 'do not rely on the operating system to do  the
  281. file searching for you'. It is far better to group your data into
  282. a few  big files  and use  your own  indexing system  to find the
  283. section of  data that you need than using the operating system.
  284.  
  285. File Structures
  286.  
  287. It is  possible to  use logical block sizes of between 0.5K to 2K
  288. on a  CD-ROM. Usually  this is  done when you have many files all
  289. less than 2K in size. You can for instance half the capacity of a
  290. CD-ROM disc  if all  your files  are 1K  in size  and all of your
  291. logical blocks  are 2K  in size.  Whatever is  defined the CD-ROM
  292. hardware will  address a 2K block minimum, so unless you can VERY
  293. reliably predict  the adjacent files to be opened within the same
  294. block this  method of  data storage proves rather inefficient. It
  295. is far better to concatenate your small files into one large file
  296. and hold an index of block offsets.
  297.  
  298. Drive Performance
  299.  
  300. Never rely  on obtaining  the theoretical   data transfer rate of
  301. 150K per  second. Piping  files through  the .SYS driver , MSCDEX
  302. and MS-DOS will slow things down. This can be a major factor when
  303. addressing   medium size  files like  images. The  only real  way
  304. around this  problem   is to  bypass all of these operations and
  305. allow your  software  to address the .SYS driver direct. This can
  306. be an  arduous task,  most developers opt for file compression to
  307. cut down the image retrieval time
  308.  
  309. We have  mentioned  already  that  the  sector  cache  is    very
  310. important when  we are  considering  file  access  times.  A  few
  311. manufacturers have  installed  a  considerable  amount  of  cache
  312. memory within the CD-ROM drive hardware. This allows a request to
  313. read a  path table  from the computer to extract data rather than
  314. another access  to the  disc. This  can  result  in  considerable
  315. apparent speed increase in your CD-ROM product.
  316.  
  317. BE WARNED,  it is  not unknown for a developer to create a CD-ROM
  318. programme that  is optimised for a particular drive, only to find
  319. that it works 100 times slower on other manufacturers drives.
  320.  
  321. As we  are dealing with relatively slow hardware, keep the number
  322. of seeks to your data file to a minimum. Use indexing and hashing
  323. tables which let you approach your data in the mst direct manner.
  324.  
  325. It is  obviously inefficient to swing from one end of the disc to
  326. another and  back again.  try to  do some access analysis on your
  327. database and  store sequentially  accessed data blocks within the
  328. same vicinity. Sometimes it is even better to duplicate some data
  329. in order  that the  seek distances  are kept  to a minimum at the
  330. expense of a little more disc estate.
  331.  
  332. All drive  manufacturers have  their own seeking algorithms which
  333. effect how  the drive  performs (see  plots attached)  . There is
  334. usually little point in optimising your long seek jumps to medium
  335. seek jumps, you will gain relatively little improvement in speed.
  336. If you  can optimise  to short  seek jumps, however, you may well
  337. get a great improvement in data accessing.
  338.  
  339. Disc Quality
  340.  
  341. It is  a surprise  to most people  to find that CD quality can be
  342. related to  the retrieval  time. You should find no problems with
  343. reputable manufacturers  , however  a dusty  or scratched    will
  344. affect the  retrieval time.  A few  of the  CD-ROM drives  in the
  345. market perform  the final layer of error correction within the PC
  346. rather than  the drive,  this can  result in  long data retrieval
  347. times when  a disc  is giving  a high  error rate.The drive might
  348. also go back automatically  to read the same block if error rates
  349. are high and in very bad cases no data will be read at all. Treat
  350. CD-ROMs as  carefully as you would any  other very  high  density
  351. storage medium  and  you  will  obtain  good  performance for the
  352. lifetime of the data and more.
  353.  
  354. Apple Discs and HFS
  355.  
  356. Most of  the rules and comments made above can be also applied to
  357. Apple and  HFS CD-ROMs. One important note, however is the purity
  358. of the  data image. Apple discs can be made by mastering directly
  359. from a hard disk.
  360.  
  361. If you  have performed  a number  of file deletes and inserts you
  362. will have  a poorly  structured hard disk with sections  of files
  363. dispersed over the hard disk surface. This rather messy structure
  364. will then be directly transferred to the CD-ROM which can then in
  365. very long  access times.  Take a  fresh empty  hard disc and copy
  366. your data, in the order that you want it to appear on the CD-ROM.
  367. This will result in a clean efficient image.
  368.  
  369. Access Time Analysis Plots for two CD-ROM Drives
  370.  
  371. Two drive  speed plots showing access times versus data location.
  372. Note that  the 'Drive  A' plot  is very linear and approaches the
  373. theoretical access  time as  distance increases.  Drive A  has a
  374. powerful head positioning mechanism and a good seek algorithm.
  375.  
  376. The  'Drive B' plot is more typical  of current CD-ROM drives. It
  377. shows that  the difference  between large access paths and medium
  378. access paths  to be  relatively small,  optimise only  for  short
  379. access paths to gain a speed advantage.
  380.  
  381. Drive A
  382.  
  383. (starting block 0)
  384.  
  385. End   Access       200     400     600     800    1000    1200
  386. Block Time(ms)       
  387.  
  388. 0              330        *
  389. 27000          490              *
  390. 54000          540                 *
  391. 81000          570                  *
  392. 108000         610                    *
  393. 135000         650                     *
  394. 162000         690                       *
  395. 189000         720                         *
  396. 216000         770                          *
  397. 243000         800                            *
  398. 270000         840                              *
  399. 297000         870                               *
  400. 324000         910                                *
  401.  
  402. Drive B
  403.  
  404. (starting block 0)
  405.  
  406. End   Access     200     400     600     800    1000    1200
  407. Block Time(ms)     
  408.  
  409. 0              320      *
  410. 27000          710                      *
  411. 54000          820                          *
  412. 81000          920                              *
  413. 108000         990                                *
  414. 135000         1040                                 *
  415. 162000         1100                                    *
  416. 189000         1150                                      *
  417. 216000         1190                                        *
  418. 243000         1240                                          *
  419. 270000         1290                                            *
  420. 297000         1330                                            *
  421. 324000         1360                                             *
  422.  
  423.  
  424.  
  425. Reference: CD-ROM aneCDote from the Nimbus Information System
  426.